package cn.hnu.jpa.bean;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
//@Table(uniqueConstraints={
//		@UniqueConstraint(
//				columnNames={"name","email"}
//		)//唯一性约束条件
//})   

//两个约束条件

@Table(uniqueConstraints={
		@UniqueConstraint(
				columnNames={"name"}
		),//唯一性约束条件
		@UniqueConstraint(
				columnNames = {"email"}
		)
})
public class Student implements Serializable{

	/**
	 * 实例 制定表的那么字段和email字段为唯一表示，也就是说不能存在
	 * 完全一样的name和email字段的记录
	 */
	private static final long serialVersionUID = 1L;
	
	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	
	private String name;
	
	private String email;

	
	
	public Student() {
	}

	public Student(String name, String email) {
		super();
		this.name = name;
		this.email = email;
	}
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	
}
